package com.mengwen.backstage.service.impl;


import com.mengwen.backstage.mapper.PartnerMapper;
import com.mengwen.backstage.pojo.Partner;
import com.mengwen.backstage.service.PartnerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Transactional
@Service
public class PartnerServiceImpl implements PartnerService {

    @Autowired
    private PartnerMapper partnerMapper;

    public Partner findByOpenid(String openid){
        return partnerMapper.findByOpenid(openid);
    }

    public Partner login(String account_number, String password) {
        return partnerMapper.login(account_number,password);
    }


    public Integer updateOpenidByAccountNumberAndPassword(String openid, String accountNumber, String md5Password) {
        return partnerMapper.updateOpenidByAccountNumberAndPassword(openid,accountNumber,md5Password);
    }


    public Partner findByAccountNumberAndPassword(String accountNumber, String md5Password) {
        return partnerMapper.findByAccountNumberAndPassword(accountNumber, md5Password);
    }

    @Override
    public Integer findStateByOpenid(String openid) {
        return partnerMapper.findStateByOpenid(openid);
    }

    @Override
    public Integer updateStateByOpenid(String openid) {
        return partnerMapper.updateStateByOpenid(openid);
    }

    @Override
    public Integer findStateByAccountNumber(String accountNumber) {
        return partnerMapper.findStateByAccountNumber(accountNumber);
    }

    @Override
    public Integer updateStateByAccountNumber(String accountNumber) {
       return partnerMapper.updateStateByAccountNumber(accountNumber);
    }

    @Override
    public Integer updateMoneyByopenid(String openid) {
        return partnerMapper.updateMoneyByopenid(openid);
    }

    @Override
    public Integer updateMoneyByunionid(String inviterUnionid, Double money) {
        return partnerMapper.updateMoneyByunionid(inviterUnionid, money);
    }

    @Override
    public int addTeammateCountByUnionid(String inviterUnionid) {
        return partnerMapper.addTeammateCountByUnionid(inviterUnionid);
    }

    @Override
    public int addPublishCountByUnionid(String inviterUnionid) {
        return partnerMapper.addPublishCountByUnionid(inviterUnionid);
    }
}
